/* The panel with ship hp and shields and armor
 * 
 */

package gui.battle;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;

import javax.swing.JPanel;

import item.ship.Ship;

public class HPPanel extends JPanel{
	
	Ship ship; //the ship the hp bars belong to
	
	
	//1 param constructor that just sets up the panel
	public HPPanel(Ship s){
		
		ship = s;
	}//Ship constructor

	
	//overrides the default paint method to draw the panel
	public void paint(Graphics g) {
		
		g.setColor(Color.BLUE);
		g.fillRect(0, (int)(120 - ((double)ship.getShields()/ship.getMaxShields()) *120), 20, (int)((double)ship.getShields()/ship.getMaxShields() *120));
	
		g.setColor(Color.YELLOW);
		g.fillRect(21, (int)(120 - ((double)ship.getArmor()/ship.getMaxArmor()) *120), 10, (int)((double)ship.getArmor()/ship.getMaxArmor() *120));
		
		g.setColor(Color.GREEN);
		g.fillRect(31, (int)(120 - ((double)ship.getHull()/ship.getMaxHull()) *120), 20, (int)((double)ship.getHull()/ship.getMaxHull() *120));
	}//paint
}//HPPanel
